package tech.aistar.day05.homework;

import java.util.Calendar;
import java.util.Date;

/**
 * 本类用来演示: 员工的总的父类
 *
 * @author: success
 * @date: 2022/7/25 8:58 上午
 */
public class Employee {
    private String name;

    private Date birthday;

    public Employee() {
    }

    public Employee(String name, Date birthday) {
        this.name = name;
        this.birthday = birthday;
    }

    //要实现的 - 过生日,多加100元
    public double getSalary(int month){
        double salary = 0.0d;

        //从birthday中取出月份
        Calendar cal = Calendar.getInstance();
        cal.setTime(birthday);//Date->Calendar

        if(cal.get(Calendar.MONTH)+1==month)
            salary = 100.0d;

        return salary;
    }
}
